﻿
#region Imports...
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Pharmacy.Data;
using Pharmacy.Entities;
using Pharmacy.Web.UI;
#endregion

public partial class DrugDispoAdd : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{		
		FormUtil.RedirectAfterInsertUpdate(FormView1, "DrugDispoEdit.aspx?{0}", DrugDispoDataSource);
		FormUtil.RedirectAfterAddNew(FormView1, "DrugDispoEdit.aspx");
		FormUtil.RedirectAfterCancel(FormView1, "DrugDispo.aspx");
		FormUtil.SetDefaultMode(FormView1, "DrugId");
        var httpCookie = Request.Cookies["LoginUser"];
        if (httpCookie != null)
        {
            WebUser id = DataRepository.WebUserProvider.GetByUserId(httpCookie.Value);
            if (id.Roles != "Pharmacist")
            {
                if (FormView1.CurrentMode == FormViewMode.Edit)
                {
                    FormView1.FooterRow.FindControl("UpdateButton").Visible = true;
                }
                else
                {
                    FormView1.FooterRow.FindControl("InsertButton").Visible = true;
                }
            }
        }
	}
}


